package com.chujian.sys.entity;

import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.chujian.SystemEchoConst;
import com.chujian.framework.annotation.echo.Echo;
import com.chujian.framework.core.IId;
import com.chujian.framework.core.base.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;


/**
 * 角色功能表
 *
 * @author chujian
 * @since 2021-08-03
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("sys_role_menu")
@KeySequence("sys_role_menu_seq")
public class SysRoleMenu extends BaseEntity implements IId {

    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "角色功能id")
    @TableId("role_menu_id")
    private Long roleMenuId;

    @ApiModelProperty(value = "功能id")
    @TableField("menu_id")
    @Echo(value = SystemEchoConst.menuEchoService, targetField = "menuName")
    private Long menuId;

    @ApiModelProperty(value = "角色id")
    @TableField("role_id")
    @Echo(value = SystemEchoConst.roleEchoService, targetField = "roleName")
    private Long roleId;

    @ApiModelProperty(value = "产品id")
    @TableField("prod_id")
    private Long prodId;

    @ApiModelProperty(value = "账套id")
    @TableField("ac_id")
    private Long acId;


    // ++++++ 系统拓展 +++++++
    @TableField(exist = false)
    private Map<String, String> query = new HashMap<>();

    @Override
    public Long getId() {
        return this.roleMenuId;
    }

    @Override
    public void setId(Serializable id) {
        if (null != id) {
            this.roleMenuId = Long.parseLong("" + id);
        }
    }

    // ++++++ 业务拓展 +++++++
    @TableField(exist = false)
    private String menuName;

    @TableField(exist = false)
    private String roleName;
}
